Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bigquery] Always escape table names #489

Merged
merged 8 commits into from
Apr 23, 2024

Conversation

nathan-artie
Copy link
Contributor

@nathan-artie nathan-artie commented Apr 23, 2024

Like MS SQL, when you create a table or column in BigQuery, and do not quote the identifier, the database uses the exact casing that the identifier was supplied in.

Create tables:

CREATE TABLE dataset.TABLEUPPER (lower INT NOT NULL, UPPER INT NOT NULL, MiXeD INT NOT NULL)
CREATE TABLE dataset.tablelower (lower INT NOT NULL, UPPER INT NOT NULL, MiXeD INT NOT NULL)
CREATE TABLE dataset.tAbLEmIxEd (lower INT NOT NULL, UPPER INT NOT NULL, MiXeD INT NOT NULL)
CREATE TABLE dataset.TaBlEMiXeD1 (lower INT NOT NULL, UPPER INT NOT NULL, MiXeD INT NOT NULL)

Query schema:

SELECT table_name, column_name, data_type, description FROM `dataset.INFORMATION_SCHEMA.COLUMN_FIELD_PATHS`

table       column  type
-----       ------  ----
TaBlEMiXeD1 lower   INT64
TaBlEMiXeD1 UPPER   INT64
TaBlEMiXeD1 MiXeD   INT64
TABLEUPPER  lower   INT64
TABLEUPPER  UPPER   INT64
TABLEUPPER  MiXeD   INT64
tablelower  lower   INT64
tablelower  UPPER   INT64
tablelower  MiXeD   INT64
tAbLEmIxEd  lower   INT64
tAbLEmIxEd  UPPER   INT64
tAbLEmIxEd  MiXeD   INT64

@nathan-artie nathan-artie requested a review from Tang8330 April 23, 2024 01:20
@nathan-artie nathan-artie marked this pull request as draft April 23, 2024 04:41
@nathan-artie nathan-artie marked this pull request as ready for review April 23, 2024 18:13
@nathan-artie nathan-artie merged commit 91f728e into master Apr 23, 2024
1 check passed
@nathan-artie nathan-artie deleted the nv/always-escape-bq-table-names branch April 23, 2024 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants